package com.yb.xczx.cloud.user.config;

import com.yb.core.web.annotation.EnableWhiteListConfig;
import com.yb.xczx.cloud.user.filter.LoginFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/5/23 11:09
 * FileName: MvcConfig
 * Description:
 */

@Configuration
@EnableWhiteListConfig
public class MvcConfig {

    @Autowired
    LoginFilter loginFilter;
    @Bean
    FilterRegistrationBean filterRegistrationBean(){
        FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.addUrlPatterns("/**");
        registrationBean.setFilter(loginFilter);
        return registrationBean;
    }
}
